<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('sys_roles', function (Blueprint $table) {
            $table->id();
            $table->string('name', 64)->default('')->comment('角色名称');
            $table->string('code', 32)->nullable()->comment('角色编码');
            $table->integer('sort')->nullable()->comment('显示顺序');
            $table->unsignedTinyInteger('status')->nullable()->default(1)->comment('角色状态(1-正常；0-停用)');
            $table->unsignedTinyInteger('data_scope')->nullable()->comment('数据权限(0-所有数据；1-部门及子部门数据；2-本部门数据；3-本人数据)');
            $table->unique('name');
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('sys_roles');
    }
};
